<?php


namespace App\Services;


class BaiduAudit
{
    /**
     * @Notes:
     * @Author:Planc,
     * @Date: 2022/10/14,
     * @Time: 17:06,
     * 百度云第三方审核内容
     */
    public static function textAudit($text){
        $appId = config("bdy.appId");
        $apiKey = config("bdy.apiKey");
        $secretKey = config("bdy.secretKey");
        $client = new \Luffy\TextCensor\Core($appId, $apiKey, $secretKey);
        $res = $client->textCensorUserDefined($text); //待审核文本字符串
        if($res['conclusion']=='不合规'){
            return $text=$res['data'][0]['msg'];
        }
    }

    /**
     * Notes: 百度云第三方审核图片
     * User: 齐硕
     * Date: 2022/11/14
     * Time:14:25
     * @param $imgs
     * @return mixed
     */
    public static function imageAudit($imgs){
        $appId = config("bdy.appId");
        $apiKey = config("bdy.apiKey");
        $secretKey = config("bdy.secretKey");
        $client = new \Luffy\TextCensor\Core($appId, $apiKey, $secretKey);
        return $client->imageAudit($imgs);
    }
}
